<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="content-language" content="es" />	
	<title>Youtube</title>
	<style>
		*{
			margin: 0;
			padding: 0;
		}
	</style>
</head>
<body>	
<?php

if(!empty($_GET['v'])){	
	list($id)= explode('-', $_GET['v']);
	$width = (empty($_GET['w'])?420:$_GET['w']);
	$height= (empty($_GET['h'])?315:$_GET['h']);
	
	$params= array(
		'hl' => 'es_ES',
		'version' => '3',
		'modestbranding' => '1',
		'theme' => 'light', //dark
		'color' => 'white', //red
		'autohide' => '1',
		'rel' => '0',
		'color1' => '0xCCCCCC',
		'color2' => '0x3B5998',
		'border' => '0',
		'fs' => '1',
		'autoplay' => '0',
		'loop' => '0',
		'disablekb' => '0',
		'egm' => '0',
		'start' => '0',
		'hd' => '0',
		'showsearch' => '1',
		'showinfo' => '1',
		'iv_load_policy' => '0',	
	);
	
	foreach($_GET as $key => $value){
		if(array_key_exists($key, $params))
			$params[$key]= $value;
	}
	
	$query= array();
	foreach($params as $param => $value){
		$query[]= $param.'='.$value;
	}
	$query= implode('&', $query);
	$url = 'http://www.youtube.com/v/'.$id.'?'.$query;

	$embed= '
		<object width="'.$width.'" height="'.$height.'">
			<param name="movie" value="'.$url.'"></param>
			<param name="allowFullScreen" value="true"></param>
			<param name="allowscriptaccess" value="always"></param>
			<embed src="'.$url.'" type="application/x-shockwave-flash" width="'.$width.'" height="'.$height.'" allowscriptaccess="always" allowfullscreen="true"></embed>
		</object>			
	';
	
	$embed= '
	<object id="myytplayer" width="'.$width.'" height="'.$height.'">
		<param name="movie" value="'.$url.'"></param>
		<param name="allowFullScreen" value="true"></param>
		<embed src="'.$url.'"
		type="application/x-shockwave-flash"
		width="'.$width.'" height="'.$height.'" 
		wmode="transparent" allowfullscreen="true"></embed>
	</object>
	';

	echo $embed;
}

?>
</body>
</html>